﻿using FluentNHibernate.Mapping;
using Jarvis.Server.Domain;

namespace Jarvis.Server.NHibernate
{
    public class LocationMap : ClassMap<Domain.Location>
    {
        public LocationMap()
        {
            Id(x => x.Id).GeneratedBy.GuidComb();
            Map(x => x.Name).Not.Nullable().Unique();
            Map(x => x.State);
            Map(x => x.StreetAddress);
            Map(x => x.City);
            HasMany(x => x.Categories).Cascade.All();
            HasMany(x => x.Actions).Cascade.All();
            References(x => x.LocationSensorDatas).Cascade.All();
        }
    }
}
